package dao

import (
	"time"
)

// 这是 File 的全局公开dao对象
var FileDao = fileDao{}

// 这是 file表 的实体类
type File struct {
	Id         int       `json:"id" form:"id" binding:"id"`
	CreatedAt  time.Time `json:"created_at" form:"created_at" binding:"created_at"`
	UpdatedAt  time.Time `json:"updated_at" form:"updated_at" binding:"updated_at"`
	DeletedAt  time.Time `json:"deleted_at" form:"deleted_at" binding:"deleted_at"`
	Name       string    `json:"name" form:"name" binding:"name"` // 文件名
	Md5        string    `json:"md5" form:"md5" binding:"md5"`
	Path       string    `json:"path" form:"path" binding:"path"`
	ChunkTotal int       `json:"chunk_total" form:"chunk_total" binding:"chunk_total"` // 当前文件的文件块总数
	IsFinish   int       `json:"is_finish" form:"is_finish" binding:"is_finish"`
}

// 注意:这是 File 的私有dao对象
type fileDao struct {
	Obj    File
	Insert func(arg File) int  //插入一条记录
	Update func(arg File) int  //更新一条记录
	Delete func(arg File) int  //删除一条记录
	Select func(arg File) File //获取一条记录
}
